<template>
  <div class="full-box shadow-box padding-box">
    <OperateCommon :showSearch="true" :showAdd="false" @search="initData">
      <template #condition>
        <div class="condition-item">
          <el-input
            v-model="queryParams.object_name"
            clearable
            placeholder="按项目名称查询"
          ></el-input>
        </div>
      </template>
    </OperateCommon>
    <div class="table-wrapper">
      <BaseTable
        :columns="columns"
        :showSort="true"
        :tableData="tableData"
        :pages="{
          show: true,
          count: count,
        }"
        :operate="{
          show: false,
        }"
        @pagination="pageChange"
      >
      </BaseTable>
    </div>
  </div>
</template>

<script>
import OperateCommon from "@/components/Common/OperateCommon.vue";
import BaseTable from "@/components/Common/BaseTable.vue";
import { getAnalyze } from "@/api/RedAlert/Index";
import commonList from "@/mixins/commonList";
export default {
  mixins: [commonList],
  components: { OperateCommon, BaseTable },
  data() {
    return {
      columns: columns,
      tableData: [],
      count: 0,
      queryParams: {
        object_name: "",
        pageNum: 1,
        pageSize: 20,
        type: 1,
      },
    };
  },
  methods: {
    initData() {
      getAnalyze(this.queryParams).then((res) => {
        if (res.code == 0) {
          this.tableData = res.data;
          this.count = res.num;
        }
      });
    },
    pageChange(val) {
      this.queryParams.pageNum = val.pageNum;
      this.queryParams.pageSize = val.pageSize;
      this.initData();
    },
  },
  created() {
    this.initData();
  },
};

const columns = [
  {
    prop: "object_name",
    label: "项目名称",
    width: "",
    minWidth: "300",
    align: "",
  },
  {
    prop: "num",
    label: "红色预警发生次数",
    width: "",
    minWidth: "150",
    align: "",
  },
  {
    prop: "num2",
    label: "交办数",
    width: "150",
    minWidth: "",
    align: "",
  },
  {
    prop: "num3",
    label: "处置数",
    width: "100",
    minWidth: "",
    align: "",
  },
  {
    prop: "num4",
    label: "问题移送数",
    width: "150",
    minWidth: "",
    align: "",
  },
  {
    prop: "num5",
    label: "整改反馈数",
    width: "150",
    minWidth: "",
    align: "",
  },
];
</script>

<style lang="scss" scoped>
</style>